package peer.gui;
import java.awt.BorderLayout;
import java.awt.Rectangle;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;


public class LogPanel extends JPanel
{
	JTextArea log;
	
	public LogPanel()
	{
		this.setLayout(new BorderLayout());
		log = new JTextArea();
		log.setEditable(false);
		add(new JScrollPane(log), BorderLayout.CENTER);
	}
	
	public void writeLog(String string)
	{
		log.append(string + '\n');
		log.scrollRectToVisible(new Rectangle(0, log.getHeight() - 2, 1, 1));
	}
}
